package com.xmy.cultivate.event.listener;

import com.xmy.cultivate.bean.message.TextMessage;
import com.xmy.cultivate.constant.EventType;

import java.util.Map;

public class SubscribeListener implements EventListener{
    @Override
    public String handleEvent(Event event) {
        Map<String, Object> message = event.getMessage();
        //System.out.println("message");
        //System.out.println(message);

        String eventType = message.get("Event").toString();
        //System.out.println("执行了关注处理类");
        if (EventType.eventType(eventType) == EventType.SUBSCRIBE) {
            return TextMessage.ofSendMsg(message, "家长您好！此平台仅用于发通知提醒和分享教育信息，老师无法看到您发送的信息，有任何问题请在VIP加油站群联系老师").toXml();
        }
        return "success";
    }

    @Override
    public EventType getEvent() {
        return EventType.SUBSCRIBE;
    }
}
